package y24.m5.file;

import java.io.*;
import java.nio.file.Files;

public class CountAa {
    private String FILE_PATH = "record.txt";
    public Integer count(){
        try {
            byte[] bytes = Files.readAllBytes(new File(FILE_PATH).toPath());
            int size = bytes.length;
            Integer count = 0;
            for (int i = 0; i < size; i++){
                if (bytes[i] == 'A' || bytes[i] == 'a'){
                    count++;
                }
            }
            return count;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }

    public static void main(String[] args) {
        System.out.println(new CountAa().count());
    }
}
